package com.hspedu.furns.dao.impl;

import com.hspedu.furns.dao.AdminDAO;
import com.hspedu.furns.dao.BasicDAO;
import com.hspedu.furns.entity.Admin;

/**
 * @author 徐
 * @version 1.0
 */
public class AdminDAOImpl extends BasicDAO<Admin> implements AdminDAO {
    /**
     * 验证管理员输入的用户名和密码
     *
     * @param username
     * @param password
     * @return 如果为空，返回null
     */
    @Override
    public Admin queryAdminByNameAndPassword(String username, String password) {
        String sql = "SELECT id,username,`password`,email,role FROM `admin` " +
                "WHERE username = ? AND `password` = MD5(?)";
        return querySingle(sql,Admin.class,username,password);
    }
}
